import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JOptionPane;

public class ButtonFrame extends JFrame{
	
	private JButton singleJButton;
	private JButton familyJButton;
	private JButton retiredJButton;

	//ButtonFrame adds JButtons to JFrame
	public ButtonFrame(){
		super("Testing Buttons");
		setLayout(new FlowLayout());
		
		singleJButton = new JButton("Single");
		add(singleJButton);
		
		familyJButton = new JButton("Family");
		add(familyJButton);
		
		retiredJButton = new JButton("Retired Couple");
		add(retiredJButton);
		
		//Create new ButtonHandler for button event handling
		ButtonHandler handler = new ButtonHandler();
		familyJButton.addActionListener(handler);
		singleJButton.addActionListener(handler);
		retiredJButton.addActionListener(handler);

	}//End ButtonFrame constructor

	//inner class for button event handling
	private class ButtonHandler implements ActionListener{
		
		public void actionPerformed(ActionEvent event){
			JOptionPane.showMessageDialog(ButtonFrame.this,String.format("You pressed: %s", event.getActionCommand()));
		}//end method ActionPerformed
	}//end private inner class ButtonHandler
}//end class ButtonFrame
	


